﻿package Classes {
	
	public class ZobristStruct {
		var dwKey:int;
		var dwLock0:int; 
		var dwLock1:int;
		public function ZobristStruct() {
			InitZero();
		}
		public function InitZero( ):void {                 // 用零填充Zobrist
			dwKey = dwLock0 = dwLock1 = 0;
		}
		public function InitRC4(rc4:RC4Struct):void 
		{        // 用密码流填充Zobrist
			dwKey = rc4.NextLong();
			dwLock0 = rc4.NextLong();
			dwLock1 = rc4.NextLong();
		}
		public function  Xor(zobr:ZobristStruct) 
		{ // 执行XOR操作
			dwKey ^= zobr.dwKey;
			dwLock0 ^= zobr.dwLock0;
			dwLock1 ^= zobr.dwLock1;
		}
		public function  Xor2(zobr1:ZobristStruct,zobr2:ZobristStruct) {
			dwKey ^= zobr1.dwKey ^ zobr2.dwKey;
			dwLock0 ^= zobr1.dwLock0 ^ zobr2.dwLock0;
			dwLock1 ^= zobr1.dwLock1 ^ zobr2.dwLock1;
		}


	}
	
}
